class Publication
  require 'state_library'
  include StateLibrary

  attr_reader :name, :channel_id, :subchannel, :marc_id, :some_path, :book_id_format, :issue_count, :max_page
  
  def initialize(name, channel_id, subchannel, marc_id, some_path, book_id_format, issue_count, max_page = 9999)
    @name = name
    @channel_id = channel_id
    @subchannel = subchannel
    @marc_id = marc_id
    @some_path = some_path
    @book_id_format = book_id_format
    @issue_count = issue_count
    @max_page = max_page
  end
  
  def download!
    download_publication(name, channel_id, subchannel, marc_id, some_path, book_id_format, issue_count, max_page)
  end
end

publications = [
  # servlet/fenyeservlet?marcid=MDFKMDAwMzEx&bookid=0311_0001&dataid=civination&modint=MA==&somepath=L21udC9taW5ndW8vcGRmMTE0NQ==&currentpage=0&currentfilename=-1&type=first&urlsize=0&subchannel=2
  # Publication.new("甲寅", 2, "MDFKMDAwMzEx", "L21udC9taW5ndW8vcGRmMTE0NQ==", "0311_%04d", 10),
  # Publication.new("最近杂志要目索引", 2, "MDFKMDAwNDUy", "L21udC9taW5ndW8vcGRmMTE0NQ==", "0452_%04d", 34),
  # Publication.new("新民丛报", 2, "MDFKMDAwNTkx", "L21udC9taW5ndW8vcGRmMTE0NQ==", "0591_%04d", 90),
  # Publication.new("京报副刊", 2, "MDFKMDAyNjY2", "L21udC9taW5ndW8vcGRmNjEy", "2666_%04d", 162),
  # Publication.new("村治", 2, "MDFKMDAwMDc0", "L21udC9taW5ndW8vcGRmMTE0NQ==", "0074_%04d", 25),
  # Publication.new("国学论文索引", 1, "MDZqaDAwOTExMw==", "L2RhdGEvcm9jYm9vaw==", "06jh009113_001", 1),
  # Publication.new("国学论文索引续编", 1, "MDZqaDAwOTI5Mw==", "L2RhdGEvcm9jYm9vaw==", "06jh009293_001", 1)
  # Publication.new("jssncdc",1,"MDFqaDAwMzAyNA==","L2RhdGEvcm9jYm9vaw==","01jh003024_001",1),
  # Publication.new("hnsncdc",1,"MDFqaDAwMzUxMw==","L2RhdGEvcm9jYm9vaw==","01jh003513_001",1),
  # Publication.new("gxsncdc",1,"MDFqaDAwMzIzMw==","L2RhdGEvcm9jYm9vaw==","01jh003233_001",1),
  # Publication.new("gxsncdc",1,"MDFqaDAwMzIzMQ==","L2RhdGEvcm9jYm9vaw==","01jh003231_001",1),
  # Publication.new("zgncfxwt",1,"MDFqaDAwMjk4NQ==","L2RhdGEvcm9jYm9vaw==","01jh002985_001",1) ,
  
  # /home/pdfRead.trs?marcid=MDdqaDAxMDY4NA==&channelid=281&bookid=07jh010684_001&dataid=civination&currentpage=1&pathinfo=749_200&top=t&type=first&subchannel=1&ifPdfReader=0&jumpType=0
  Publication.new("定县土地调查", 281, 1, "MDdqaDAxMDY4NA==", "749_200", "07jh010684_001", 1, 104),
  
  # /home/pdfRead.trs?marcid=MDFKMDAwNDk2&channelid=6&bookid=0496_0001&dataid=civination&currentpage=1&pathinfo=649_200&top=&haveTop=false&type=first&subchannel=2&ifPdfReader=0&jumpType=0&filenameSize=3&part=0
  Publication.new("中国农民银行月刊", 6, 2,"MDFKMDAwNDk2","649_200","0496_%04d", 16, 220)
]

publications.each{|publication| publication.download!}

